package com.ndp.fb.scheduler.job.statistics;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ndp.fb.constant.ConfigConst;
import com.ndp.fb.mq.api.service.schedulerservice.business.ScanAdSetStatisticsService;
import com.ndp.fb.scheduler.annotation.CronScheduled;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 定时扫描AdSet统计数据，找出发生变化的AdSet
 */
@Component
public class ScanAdSetStatisticsJob {
    private static Logger logger = LoggerFactory.getLogger(ScanAdSetStatisticsJob.class);

    @Reference
    ScanAdSetStatisticsService scanAdSetStatisticsService;

    /**
     * 定时扫描AdSet统计数据，找出发生变化的AdSet，并通过RocketMQ将消息发送出去
     */
    @CronScheduled(cronkey = ConfigConst.SCHEDULE_SCAN_ADSET_STATISTICS, enablekey = ConfigConst.SCHEDULE_SCAN_ADSET_STATISTICS_ENABLE)
    public void findChangedAdSetAndNotice() {
        logger.info("定时扫描AdSet统计数据，找出发生变化的AdSet，并通过RocketMQ将消息发送调度开始");
        scanAdSetStatisticsService.findChangedAdSetAndNotice();
    }

}
